<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>简易弹窗计算器</title>
    <script>
        // var order = parseInt(prompt("欢迎使用简易计算器：\n 1. 加法运算：\n 2. 减法运算： \n 3. 乘法运算：\n 4. 除法运算：\n 5. 退出："));

        function put1() {
            var num1 = parseInt(prompt("请输入第一个值:"));
            return num1;
        }
        function put2() {
            var num2 = parseInt(prompt("请输入第二个值:"));
            return num2;
        }
        function countNum() {
            /* if (order == 1) {
                alert("两个值相加为：" + (put1() + put2()));
            } */
            do {
                var order = parseInt(prompt("欢迎使用简易计算器：\n 1. 加法运算：\n 2. 减法运算： \n 3. 乘法运算：\n 4. 除法运算：\n 5. 退出："));
                order == 1 ? (alert("两个值相加为：" + (put1() + put2()))) : (order == 2 ? (alert("两个值相减为：" + (put1() - put2()))) : (order == 3 ? (alert("两个值相乘为：" + (put1() * put2()))) : (order == 4 ? (alert("两个值相除为：" + (put1() / put2()))) : (order == 5 ? (alert("计算完毕退出!")) : (alert("请输入正确操作指令"))))));
            } while (order != 5);
        }
        countNum();
    </script>
</head>

<body>

</body>

</html>